package com.ruoyi.app.controller;
import com.ruoyi.app.domain.Patient;
import com.ruoyi.app.domain.vo.AppointmentVo;
import com.ruoyi.app.service.AppointmentService;
import com.ruoyi.app.service.AppointmentVoService;
import com.ruoyi.app.service.PatientService;
import com.ruoyi.app.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("appointment")
@RestController
public class AppointmentVoController {
    @Autowired
    AppointmentVoService appointmentVoService;
    @Autowired
    PatientService patientService;
    @Autowired
    AppointmentService appointmentService;

    @RequestMapping("list")
    public Result list
            (
                    @RequestParam("doctorId") Integer doctorId ,
                    @RequestParam("scheduleId") Integer scheduleId ,
                    @RequestParam("patientId") Integer patientId ,
                    @RequestParam("deptId") Integer deptId
            )
    {
        AppointmentVo appointmentVo = appointmentVoService.selectAppointmentList(doctorId,scheduleId,deptId);
        Patient patient = patientService.getByNameById(patientId);
        appointmentVo.setPatient(patient);
        return Result.ok(appointmentVo);
    }
}
